﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Imgalib.Utility;
using System.Text;

namespace Mukhopatro
{
    public partial class contact_us : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnMessage_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                try
                {
                    Emailer emailer = new Emailer();
                    emailer.SMTP_HOST = "";
                    emailer.SMTP_PASSWORD = "";
                    emailer.SMTP_USER_NAME = "";
                    string messgae = string.Empty;
                    StringBuilder mailbody = new StringBuilder();
                    mailbody.AppendLine("Hi Admin,");
                    mailbody.AppendLine(txtMessage.Text);
                    mailbody.AppendLine("Thanks,");
                    mailbody.AppendLine(txtName.Text.Trim());
                    mailbody.AppendLine(txtCompany.Text.Trim());
                    emailer.SendMail(SessionManager.SITE_CUSTOMER_SETTINGS.CustomerSupport, txtEmail.Text.Trim(), txtName.Text.Trim(), "Contact Request", mailbody.ToString(), ref messgae);
                    respMessage.SetSuccessMessage("Thanks for contacting with us.");
                    txtName.Text = string.Empty;
                    txtEmail.Text = string.Empty;
                    txtCompany.Text = string.Empty;
                    txtMessage.Text = string.Empty;
                }
                catch (Exception ex)
                {
                    respMessage.SetFailMessage("Error: " + ex.Message);
                }
            }
        }
    }
}